<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>nav</title>
    </head>
    <body style="overflow-x: hidden;">

    <!-- 显示管理 -->
        {if $show}
            <div class="row" style="display: inline-block; margin-bottom: 30px;">
                <div class="col-md-12">
                    <ol class="breadcrumb" style="background: #FFFFFF; border-bottom: 1px solid #dfdfdf; border-radius: 0;">
                        <li><a href="?c=admin">后台首页</a></li>
                        <li><a href="?c=nav&action=show">导航管理</a></li>
                        <li class="active">所有导航</li>
                    </ol>
                </div>
            </div>

            <div class="row">
                <div class="col-md-12">
                    <form action="" method="post">
                        <table class="table table-bordered" style="width: 90%; margin: auto;">
                            <tr>
                                <th>导航名</th>
                                <th>描述</th>
                                <th>状态</th>
                                <th>操作</th>
                                <th>排序</th>
                                <th>
                                    <label for="allNav">全选 </label>
                                    <input type="checkbox" id="allNav">
                                </th>
                            </tr>
                            {foreach $navData as $key=>$value}
                            <tr>
                                <td>{$value['name']}</td>
                                <td>{$value['decs']}</td>
                                <td>{$value['state']}</td>
                                <td>
                                    <a href="?c=nav&action=update&id={$value['id']}">修改</a>
                                    <a href="?c=nav&action=delete&id={$value['id']}">删除</a>
                                </td>
                                <td>
                                    <input type="text" value="{$value['sort']}" name="sorts[{$value['id']}]" class="form-control text-center" style="width: 50px">
                                </td>
                                <td>
                                    <label for="{$value['id']}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                                    <input type="checkbox" id="{$value['id']}" class="choose" name="checked[]" value="{$value['id']}">
                                </td>
                            </tr>
                            {/foreach}
                            <script type="text/javascript">
//                                on：对将来有脚本生成的元素的js有效果
                                $(document).on('click','#allNav',function () {
                                        $(".choose").prop("checked",$(this).prop("checked"));
                                });
                            </script>
                            <tr>
                                <td colspan="4">
                                    {$allPage}
                                </td>
                                <td style="vertical-align: middle">
                                    <input type="submit" name="sort" value="排序" class="btn btn-primary">
                                </td>
                                <td style="vertical-align: middle">
                                    <input type="submit" name="delete" value="删除" class="btn btn-danger">
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        {/if}

    <!-- 添加导航 -->
        {if $add}
            <div class="row" style="display: inline-block; margin-bottom: 30px;">
                <div class="col-md-12">
                    <ol class="breadcrumb" style="background: #FFFFFF; border-bottom: 1px solid #dfdfdf; border-radius: 0;">
                        <li><a href="?c=admin">后台首页</a></li>
                        <li><a href="?c=nav&action=show">导航管理</a></li>
                        <li class="active">添加导航</li>
                    </ol>
                </div>
            </div>

            <div class="row">
                <div class="col-md-12">
                    <form action="" method="post" enctype="multipart/form-data">
                        <table class="table table-bordered" style="width: 90%; margin: auto;">
                            <tr>
                                <td class="text-center" width="120">导航名称</td>
                                <td><input type="text" class="form-control" name="navName"></td>
                            </tr>
                            <tr>
                                <td class="text-center" width="120">导航描述</td>
                                <td><input type="text" class="form-control" name="navDecs"></td>
                            </tr>
                            <tr>
                                <td colspan="2" class="text-center">
                                    <input type="submit" value="提交" name="send" class="btn btn-success">
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        {/if}

    <!-- 更新导航 -->
        {if $update}
            <div class="row" style="display: inline-block; margin-bottom: 30px;">
                    <div class="col-md-12">
                        <ol class="breadcrumb" style="background: #FFFFFF; border-bottom: 1px solid #dfdfdf; border-radius: 0;">
                            <li><a href="?c=admin">后台首页</a></li>
                            <li><a href="?c=nav&action=show">导航管理</a></li>
                            <li class="active">修改导航</li>
                        </ol>
                    </div>
                </div>

            <div class="row">
                <div class="col-md-12">
                    <form action="" method="post" enctype="multipart/form-data">
                        <table class="table table-bordered" style="width: 98%; margin: auto;">
                            <tr>
                                <td class="text-center" width="120">导航名称</td>
                                <td><input type="text" class="form-control" name="navName" value="{$data[0]['name']}"></td>
                            </tr>
                            <tr>
                                <td class="text-center" width="120">导航描述</td>
                                <td><input type="text" class="form-control" name="navDecs" value="{$data[0]['decs']}"></td>
                            </tr>
                            <tr>
                                <td colspan="2" class="text-center">
                                    <input type="submit" value="提交" name="send" class="btn btn-success">
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        {/if}
    </body>
</html>